/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Pedro
 */
public class DoublyLinkedNode <E>{

        //Atributos.
	protected E data;
	protected DoublyLinkedNode<E> nextElement;
	protected DoublyLinkedNode<E> previousElement;
        
        //Constructor.
	public DoublyLinkedNode(E v, DoublyLinkedNode<E> next, DoublyLinkedNode<E> previous)
	{
		data = v;
		nextElement = next;
		if (nextElement != null)
			nextElement.previousElement = this;
		previousElement = previous;
		if (previousElement != null)
			previousElement.nextElement = this;
	}
	
	public DoublyLinkedNode(E v)
	// post: constructs a single element
	{
	this(v,null,null);
	}
	
	public DoublyLinkedNode<E> previous()
	{
		return previousElement;
	}
	
	public DoublyLinkedNode<E> setNext(E variable)
	{
		return null; 
	}
	
	public E value()
	{
		return data;
	}
}

